home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / graphics.17 / graphics / graphics-0.17 / plot2fig / cont.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-12  |  2.0 KB  |  68 lines

  1. /* plot, unix plot file to graphics device translators.
  2.    Copyright (C) 1989 Free Software Foundation, Inc.
  3.  
  4.    plot is distributed in the hope that it will be useful, but WITHOUT
  5.    ANY WARRANTY.  No author or distributor accepts responsibility to
  6.    anyone for the consequences of using it or for whether it serves any
  7.    particular purpose or works at all, unless he says so in writing.
  8.    Refer to the GNU General Public License for full details.
  9.    
  10.    Everyone is granted permission to copy, modify and redistribute plot,
  11.    but only under the conditions described in the GNU General Public
  12.    License.  A copy of this license is supposed to have been given to you
  13.    along with plot so you can know your rights and responsibilities.  It
  14.    should be in a file named COPYING.  Among other things, the copyright
  15.    notice and this notice must be preserved on all copies.  */
  16.  
  17.  
  18. /* This file is the cont routine, which is a standard part of the plot
  19.    library. It continues a line from the last point drawn to the point
  20.    specified by x and y.
  21.    */
  22. #include "sys-defines.h"
  23. #include "libplot.h"
  24. #include "extern.h"
  25.  
  26. int last_x=0, last_y = 0; /* location of the last coordinates used */
  27.  
  28. int PointsInLine=0;
  29.  
  30.  
  31. int
  32. cont (x, y)
  33.      int x, y;
  34. {
  35.   if (PointsInLine <= 1)
  36.     {
  37.       printf ("%d %d %d %d %d %d %d %d %.3f %d %d %d\n\t",
  38.          2,            /* polyline object */
  39.          1,            /* polyline subtype */
  40.          line_style,    /* style */
  41.          1,            /* thickness */
  42.          0,            /* color */
  43.          0,            /* depth */
  44.          0,            /* pen */
  45.          (int) fill_level,    /* area fill */
  46.          dash_length,    /* style val */
  47.          0,            /* radius */
  48.          0,            /* forward arrow */
  49.          0            /* backward arrow */
  50.          );
  51.     }
  52.   if (PointsInLine = 1)
  53.     {
  54.       printf(" %d %d",
  55.          (int) ((last_x - x_input_min)/ x_scale + x_output_min),
  56.          (int) ((last_y - y_input_min)/ y_scale + y_output_min));
  57.     }
  58.  
  59.   PointsInLine++;
  60.   printf(" %d %d",
  61.      (int) ((x - x_input_min)/ x_scale + x_output_min),
  62.      (int) ((y - y_input_min)/ y_scale + y_output_min));
  63.   last_x = x;
  64.   last_y = y;
  65.   
  66.   return 0;
  67. }
  68.